﻿<UserControl x:Class="VH.View.AddCustomerHearingAidOrderView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:resources="clr-namespace:VH.Resources;assembly=VH.Resources"
             xmlns:controls="clr-namespace:VH.UI.UserControls.Controls;assembly=VH.UI.UserControls"
             xmlns:view="clr-namespace:VH.View"
             xmlns:userControls="clr-namespace:VH.UI.UserControls;assembly=VH.UI.UserControls"
             mc:Ignorable="d" >
    <UserControl.InputBindings>
        <KeyBinding  Key="Escape" Command="{Binding CancelCommand}" />
        <KeyBinding  Key="Enter" Command="{Binding SaveCommand}" />
    </UserControl.InputBindings>
    <Grid>
        <AdornerDecorator>
            <ScrollViewer>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="8" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <Grid Grid.Row="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <!--<ColumnDefinition Width="*" />-->
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="5" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="5" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="5" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="5" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="5" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="5" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="5" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="5" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="5" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="5" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="5" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="5" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="5" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="5" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <controls:VHLabel
                        AddEndingPunctuation="True"
                        Content="{x:Static  resources:LabelResources.OrderDate}" />
                        <DatePicker
                        Grid.Column="1"
                        HorizontalAlignment="Left"
                        SelectedDate="{Binding Entity.OrderDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                        Validation.ErrorTemplate="{DynamicResource errorTemplateSilverlightStyle}"
                        Width="150" />

                        <controls:VHLabel
                            AddEndingPunctuation="True"
                            Grid.Row="2"
                            Content="{x:Static  resources:LabelResources.EarSide}" />
                        <ComboBox
                            Grid.Row="2"
                            Grid.Column="1"
                            Width="120"
                            HorizontalAlignment="Left"
                            SelectedValue="{Binding Entity.EarSide, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            view:VHAttachedProperties.BindEnumToItemSource="VH.Model.EarSide, VH.Model" />

                        <controls:VHLabel
                        AddEndingPunctuation="True"
                        Grid.Row="4"
                        Content="{x:Static  resources:LabelResources.Company}" />
                        <ComboBox
                        Grid.Row="4"
                        Grid.Column="1"
                        Width="120"
                        HorizontalAlignment="Left"
                        SelectedValue="{Binding Entity.Company, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        view:VHAttachedProperties.BindEnumToItemSource="VH.Model.Company, VH.Model" />

                        <controls:VHLabel
                            Grid.Row="6"
                            AddEndingPunctuation="True"
                            Content="{x:Static  resources:LabelResources.HearingAidType}" />
                        <ComboBox
                            Grid.Row="6"
                            Grid.Column="1"
                            Width="120"
                            HorizontalAlignment="Left"
                            SelectedValue="{Binding Entity.HearingAidType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            view:VHAttachedProperties.BindEnumToItemSource="VH.Model.HearingAidType, VH.Model" />

                        <controls:VHLabel
                            AddEndingPunctuation="True"
                            Grid.Row="8"
                            Grid.Column="0"
                            Visibility="{Binding Entity.IsRightModel, Converter={userControls:BoolToVisibilityValueConverter}}"
                            Content="{x:Static  resources:LabelResources.Model_Right}" />
                        <TextBox
                            Grid.Row="8"
                            Grid.Column="1"
                            Width="300"
                            HorizontalAlignment="Left"
                            Visibility="{Binding Entity.IsRightModel, Converter={userControls:BoolToVisibilityValueConverter}}"
                            Text="{Binding Entity.HiModelRight, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />

                        <controls:VHLabel
                            AddEndingPunctuation="True"
                            Grid.Row="10"
                            Grid.Column="0"
                            Visibility="{Binding Entity.IsLeftModel, Converter={userControls:BoolToVisibilityValueConverter}}"
                            Content="{x:Static  resources:LabelResources.Model_Left}" />
                        <TextBox
                            Grid.Row="10"
                            Grid.Column="1"
                            Width="300"
                            HorizontalAlignment="Left"
                            Visibility="{Binding Entity.IsLeftModel, Converter={userControls:BoolToVisibilityValueConverter}}"
                            Text="{Binding Entity.HiModelLeft, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />

                        <controls:VHLabel
                        AddEndingPunctuation="True"
                        Grid.Row="12"
                        Grid.Column="0"
                            Visibility="{Binding Entity.IsRightModel, Converter={userControls:BoolToVisibilityValueConverter}}"
                        Content="{x:Static  resources:LabelResources.SerialNumberR}" />
                        <TextBox
                        Grid.Row="12"
                        Grid.Column="1"
                        Width="300"
                        HorizontalAlignment="Left"
                            Visibility="{Binding Entity.IsRightModel, Converter={userControls:BoolToVisibilityValueConverter}}"
                        Text="{Binding Entity.SerialNumberRight, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />

                        <controls:VHLabel
                        AddEndingPunctuation="True"
                        Grid.Row="14"
                        Grid.Column="0"
                            Visibility="{Binding Entity.IsLeftModel, Converter={userControls:BoolToVisibilityValueConverter}}"
                        Content="{x:Static  resources:LabelResources.SerialNumberL}" />
                        <TextBox
                        Grid.Row="14"
                        Grid.Column="1"
                        Width="300"
                        HorizontalAlignment="Left"
                            Visibility="{Binding Entity.IsLeftModel, Converter={userControls:BoolToVisibilityValueConverter}}"
                        Text="{Binding Entity.SerialNumberLeft, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />

                        <controls:VHLabel
                            AddEndingPunctuation="True"
                            Grid.Row="16"
                            Content="{x:Static  resources:LabelResources.BatterySize}" />
                        <ComboBox
                            Grid.Row="16"
                            Grid.Column="1"
                            Width="120"
                            HorizontalAlignment="Left"
                            SelectedValue="{Binding Entity.BatterySize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            view:VHAttachedProperties.BindEnumToItemSource="VH.Model.BatterySize, VH.Model" />

                        <controls:VHLabel
                            AddEndingPunctuation="True"
                            Grid.Row="18"
                            Grid.Column="0"
                            Content="{x:Static  resources:LabelResources.Amount}" />
                        <TextBox
                            Grid.Row="18"
                            Grid.Column="1"
                            Width="150"
                            HorizontalAlignment="Left"
                            userControls:TextBoxMaskBehavior.Mask="Decimal"
                            Text="{Binding Entity.Amount, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />

                        <controls:VHLabel
                            AddEndingPunctuation="True"
                            Grid.Row="20"
                            Grid.Column="0"
                            Content="{x:Static  resources:LabelResources.AdvanceAmount}" />
                        <TextBox
                            Grid.Row="20"
                            Grid.Column="1"
                            Width="150"
                            HorizontalAlignment="Left"
                            userControls:TextBoxMaskBehavior.Mask="Decimal"
                            Text="{Binding Entity.AdvanceAmtReceived, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />

                        <controls:VHLabel
                            AddEndingPunctuation="True"
                            Grid.Row="22"
                            Grid.Column="0"
                            Content="{x:Static  resources:LabelResources.BalanceAmount}" />
                        <TextBlock
                            Grid.Row="22"
                            Grid.Column="1"
                            Width="150"
                            HorizontalAlignment="Left"
                            Text="{Binding Entity.BalanceAmount, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />

                        <Grid  Grid.Row="24" Grid.ColumnSpan="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="5"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>

                            <controls:VHLabel
                            AddEndingPunctuation="True"
                            Content="{x:Static  resources:LabelResources.OrderStatus}" />
                            <ComboBox
                            Grid.Column="1"
                            Width="120"
                                Margin="100,0,0,0"
                            HorizontalAlignment="Left"
                            SelectedValue="{Binding Entity.OrderStatus, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            view:VHAttachedProperties.BindEnumToItemSource="VH.Model.OrderStatus, VH.Model" />

                            <!--<controls:VHLabel
                                  Grid.Column="3"
                            AddEndingPunctuation="True"
                                Visibility="{Binding Entity.IsReceived, Converter={userControls:BoolToVisibilityValueConverter}}"
                            Content="{x:Static  resources:LabelResources.ReceivedDate}" />-->
                            <DatePicker
                            Grid.Column="4"
                            HorizontalAlignment="Left"
                                Visibility="{Binding Entity.IsReceived, Converter={userControls:BoolToVisibilityValueConverter}}"
                            SelectedDate="{Binding Entity.ReceivedDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                                Width="150" />

                            <!--<controls:VHLabel
                                  Grid.Column="3"
                            AddEndingPunctuation="True"
                                Visibility="{Binding Entity.IsDelivered, Converter={userControls:BoolToVisibilityValueConverter}}"
                            Content="{x:Static  resources:LabelResources.DeliveredDate}" />-->
                            <DatePicker
                            Grid.Column="4"
                            HorizontalAlignment="Left"
                                Visibility="{Binding Entity.IsDelivered, Converter={userControls:BoolToVisibilityValueConverter}}"
                            SelectedDate="{Binding Entity.DeliveredDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                                Width="150" />

                            <!--<controls:VHLabel
                                  Grid.Column="3"
                            AddEndingPunctuation="True"
                                Visibility="{Binding Entity.IsInformed, Converter={userControls:BoolToVisibilityValueConverter}}"
                            Content="{x:Static  resources:LabelResources.InformedDate}" />-->
                            <DatePicker
                            Grid.Column="4"
                            HorizontalAlignment="Left"
                                Visibility="{Binding Entity.IsInformed, Converter={userControls:BoolToVisibilityValueConverter}}"
                            SelectedDate="{Binding Entity.InformedDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                                Width="150" />
                        </Grid>

                        <controls:VHLabel
                            Grid.Row="26"
                            AddEndingPunctuation="True"
                            Content="{x:Static  resources:LabelResources.WarrantyCardGiven}" />
                        <ComboBox
                            Grid.Row="26"
                            Grid.Column="1"
                            Width="120"
                            HorizontalAlignment="Left"
                            SelectedValue="{Binding Entity.WarrantyCardGiven, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            view:VHAttachedProperties.BindEnumToItemSource="VH.Model.WarrantyCardGiven, VH.Model" />
                        
                        <controls:VHLabel
                            AddEndingPunctuation="True"
                            Grid.Row="28"
                            Content="{x:Static  resources:LabelResources.Comment}" />
                        <TextBox
                            Grid.Row="28"
                            Grid.Column="1"
                            Text="{Binding Entity.Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                            HorizontalAlignment="Left"
                            Width="300"
                            TextWrapping="WrapWithOverflow"
                            AcceptsReturn="True" VerticalContentAlignment="Top" Height="40" />
                    </Grid>

                    <Grid
                        HorizontalAlignment="Center"
                        Grid.Row="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="10" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Button
                            Content="{x:Static  resources:ButtonResources.Save}"
                            Command="{Binding SaveCommand}" />
                        <Button
                            Content="{x:Static  resources:ButtonResources.Cancel}"
                            Grid.Column="2"
                            Command="{Binding CancelCommand}" />
                    </Grid>
                </Grid>
            </ScrollViewer>
        </AdornerDecorator>
    </Grid>
</UserControl>
